﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GenericLibrariesToolKit;
using GenericLibrariesToolKit.Enumeration;
using BLL.Users.Impl;
using BLL.Users;
using Model;
using Utils;

public partial class Page_Security_ChangePswd : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        
    }


    /// <summary>
    /// 修改密码
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnChangePasswordSubmit_Click(object sender, ImageClickEventArgs e)
    {
        UserBO userBO = new UserBOImpl();
        string userID = WebUtil.GetIdentifier(Session["userId"]);
        //获取数据
        string oldPassword = txtChangePasswordPassword.Text.ToString();
        string NewPasswordconfirm = txtChangePasswordNewPasswordConfirm.Text.ToString();
        //封装数据
        User user = new User
        {
            UserPassword = oldPassword,
            UserId = userID,
        };
        //修改密码
        string result = userBO.UpdatePassword(user, NewPasswordconfirm);
        Response.Write(WebUtil.GetTipsAndRedirect(result,WebUtil.GetCurrentPath(Request.Url) + "Home.aspx"));
    }


    //Back
    protected void btnChangePasswordBack_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect(WebUtil.GetCurrentPath(Request.Url) + "Home.aspx");
    }

}